home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Amiga Collections: Taifun
/
Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).zip
/
Taifun 099 (1989-05-15)(Ossowski, Stefan)(DE)(PD).adf
/
PCQ
/
Examples
/
Typer.p
< prev
next >
Wrap
Text File
|
1989-03-31
|
1KB
|
61 lines
Program Typer;
{
Instead of using the AmigaDOS routines, I'm going to just
use the Pascal routines. This is supposed to be for
demonstration, after all, not efficiency. Link this with
Blink Typer.o small.lib to Typer library pcq.lib
}
var
Infile : Text;
Function GetFileName(index : Integer): String;
{
This function requires that each file name in the command
line have at least one character of disposable delimeter
after it. It starts looking from index, and returns a
pointer into the command line. Index ends up as the next
unused character.
}
var
name : String;
begin
while ((CommandLine[index] = ' ') or (CommandLine[index] = chr(9))) and
(index < 128) do
index := index + 1;
if index >= 128 then begin
writeln('Bad file name.');
exit(20);
end;
name := String(adr(CommandLine[index]));
while (ord(CommandLine[index]) > ord(' ')) and
(ord(CommandLine[index]) < 128) and
(index < 128) do
index := index + 1;
if index >= 128 then begin
writeln('Bad file name.');
exit(20);
end;
CommandLine[index] := chr(0);
index := index + 1;
GetFileName := name;
end;
begin
if reopen(GetFileName(1), Infile) then begin
while not eof(Infile) do begin
write(Infile^);
get(Infile);
end;
close(Infile);
end else
writeln('Could not open the input file.');
end.